//
//  CityTopTableViewCell.m
//  XRSquare
//
//  Created by UaenaMo on 2018/8/16.
//  Copyright © 2018年 UaenaMo. All rights reserved.
//

#import "CityTopTableViewCell.h"

@interface CityTopTableViewCell ()
{
    UILabel * currentLabel;
    UILabel * currentCityLabel;
    UILabel * currentSelect;
    UILabel * currentSelectLabel;
}
@end

@implementation CityTopTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        currentLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, ScreenWidth/2, 20)];
        currentLabel.font = [UIFont systemFontOfSize:15];
        [self addSubview:currentLabel];
        
        currentCityLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 30, ScreenWidth/2, 20)];
        currentCityLabel.font = [UIFont boldSystemFontOfSize:17];
        currentCityLabel.textColor = [UIColor orangeColor];
        [self addSubview:currentCityLabel];

        currentSelect = [[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth/2, 10, ScreenWidth/2, 20)];
        currentSelect.font = [UIFont systemFontOfSize:15];
        [self addSubview:currentSelect];
        
        currentSelectLabel = [[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth/2, 30, ScreenWidth/2, 20)];
        currentSelectLabel.font = [UIFont boldSystemFontOfSize:17];
        currentSelectLabel.textColor = [UIColor orangeColor];
        [self addSubview:currentSelectLabel];
        
        UIButton * geoLocation = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth/2, 60)];
        [geoLocation addTarget:self action:@selector(geoLocaitonAciton) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:geoLocation];
        
        UIButton * selectLocation = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth/2, 60)];
        [selectLocation addTarget:self action:@selector(selectLocaitonAciton) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:selectLocation];
        
    }
    return self;
}

+(CGFloat)height
{
    return 60;
}

-(void)loadData:(NSString *)data
{
    currentLabel.text = @"当前城市";
    currentCityLabel.text = [[NSUserDefaults standardUserDefaults]objectForKey:@"geocity"];
    currentSelect.text = @"已选城市";
    if (!data)
    {
        data = @"未选择";
    }
    currentSelectLabel.text = data;
}

-(void)geoLocaitonAciton
{
    [self.delegate geoLocaitonAction];
}

-(void)selectLocaitonAciton
{
    [self.delegate selectLocaittonAction];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
